/*
 *  POJ1068: Parencodings
 */

/*-------- Includes --------*/
#include <iostream>

using namespace std;

/*-------- Main Function --------*/
int main(int argc, char const *argv[])
{
    // n: number of cases, m: number of pairs of parentheses
    int n, m;

    cin >> n;

    while (n--) {
        cin >> m;

        int ps[m], xs[m];

        for (int i = 0; i < m; i++)
            cin >> ps[i];

        xs[0] = ps[0];

        for (int i = 1; i < m; i++)
            xs[i] = ps[i] - ps[i-1];

        for (int i = 0; i < m; i++) {
            for (int j = i; j >= 0; j--) {
                if (xs[j] > 0) {
                    xs[j]--;
                    cout << i - j + 1 << " ";
                    break;
                }
            }
        }

        cout << endl;
    }

    return 0;
}
